﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

public class ChessBoard : MonoBehaviour
{
    public static ChessBoard Get = null;

    public List<Square> squares;

    public Square this[int x, int y]
    {
        get
        {
            foreach (Square square in squares)
            {
                if (square.location.x == x && square.location.y == y)
                {
                    return square;
                }
            }
            return null;
        }
    }
    public Square this[Location location]
    {
        get
        {
            return this[location.x, location.y];
        }
    }

    private void Awake()
    {
        Get = this;
    }
}